@page "/Admin/Config"
@using AdminBlazor.Entities

<PageTitle>系统设置</PageTitle>

<div class="container-fluid">
    <div class="row">
        <div class="col-12">

            <AdminTable2 TItem="ConfigEntity" Context="item" PageSize="-1" Title="系统设置"
                IsSearchText="false"
                OnQuery="OnQuery" InitQuery="InitQuery" OnEdit="OnEdit">

                <TableHeader>
                    <th>是否系统</th>
                    <th>名称</th>
                    <th>唯一码</th>
                    <th>值</th>
                    <th>说明</th>
                    <th>创建时间</th>
                </TableHeader>
                <TableTh1>名称</TableTh1>
                <TableTd1>@item.Name</TableTd1>
                <TableRow>
                    <td>@item.IsSystem</td>
                    <td>@item.Name</td>
                    <td>@item.Code</td>
                    <td>@item.Content</td>
                    <td>@item.Rmark</td>
                    <td>@item.CreatedTime?.ToString("yyyy-MM-dd HH:mm:ss")</td>
                </TableRow>
                <EditTemplate>
                    <div class="row">
                        <div class="form-group col-12">
                            <label class="form-label">上级</label>
                            <SelectEntity TItem="ConfigEntity" TKey="long" @bind-Value="item.ParentId" DisplayText="e => e.Name" />
                        </div>
                        <div class="form-group col-12">
                            <label class="form-label">名称</label>
                            <input @bind="item.Name" type="text" class="form-control" placeholder="" maxlength="200">
                        </div>
                        <div class="form-group col-12">
                            <label class="form-label">唯一码</label>
                            <input @bind="item.Code" type="text" class="form-control" placeholder="" maxlength="30">
                        </div>
                        <div class="form-group col-12">
                            <label class="form-label">值</label>
                            <textarea @bind="item.Content" class="form-control" placeholder="" maxlength="500"></textarea>
                        </div>
                        <div class="form-group col-12">
                            <label class="form-label">说明</label>
                            <textarea @bind="item.Rmark" class="form-control" placeholder="" maxlength="200"></textarea>
                        </div>
                    </div>
                </EditTemplate> 
            </AdminTable2>
        </div>
    </div>
</div>

@code {

    [Inject] IAggregateRootRepository<ConfigEntity> repo { get; set; }

    async Task InitQuery(AdminQueryInfo e)
    {
        e.Filters = new AdminFilterInfo[]
        {
        };
        await Task.Yield();
    }
    void OnQuery(AdminQueryEventArgs<ConfigEntity> e)
    {
    }

    async Task OnEdit(ConfigEntity item)
    {
        await Task.Yield();
    }
}
